﻿@model TuanAnhPersonalWeb.Models.AccountWrapper

@{
    ViewBag.Title = "Details";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

<h2>Details</h2>

    @using (Html.BeginForm()) {
        @Html.ValidationSummary(true) 
        
        <fieldset>
            <legend>Fields</legend>
            <div id="demo">
    <ul>
        <li class="selected" onclick="getvalue('user')"><a href="#tabuser"><em id="user">User Infomation</em></a></li>
        <li><a href="#tabmembership" onclick="getvalue('membership')"><em id="membership">Membership Information</em></a></li>
       <li><a href="#tabrole" onclick="getvalue('role')"><em id="role">Role Infomation</em></a></li> 
    </ul>                 
    <div>
                    <div id="tabuser">
                        <table width="100%">
                            <tr>
                                <td>User Name:</td><td colspan="3">@Html.TextBoxFor(model => model.MembershipUser.UserName, new { @readonly = true })
                                @Html.HiddenFor(m => m.MembershipUser.UserName)
                                @Html.HiddenFor(m => m.MembershipUser.UserId)
                                @Html.HiddenFor(m => m.MembershipUser.ApplicationId)  
                                </td>
                            </tr>
                            <tr>
                                <td>Mobile Alias:</td><td>@Html.TextBoxFor(model => model.MembershipUser.MobileAlias, new { @readonly = true })</td>                                
                            </tr>
                        </table>                        
                    </div>
                    <div id="tabmembership">                        
                            <table width="100%">
                                <tr>
                                    <td>Email:</td><td colspan="3">@Html.TextBoxFor(model => model.MembershipUser.Email, new { @readonly = true })</td>
                                </tr>
                                <tr>
                                    <td>Create Date:</td><td>@Html.TextBoxFor(model => model.MembershipUser.CreateDate, new { @readonly = true })</td>                                    
                                </tr>
                                <tr>
                                    <td>Last Login Date:</td><td>@Html.TextBoxFor(model => model.MembershipUser.LastLoginDate, new { @readonly = true })</td>                                
                                    <td>Last Password Changed Date:</td><td>@Html.TextBoxFor(model => model.MembershipUser.LastPasswordChangedDate, new { @readonly = true })</td>
                                </tr>
                                <tr>
                                    <td>Last Lockout Date:</td><td>@Html.TextBoxFor(model => model.MembershipUser.LastLockoutDate, new { @readonly = true })</td>
                                    <td>Failed Password Count</td><td>@Html.TextBoxFor(model => model.MembershipUser.FailedPasswordAttemptCount, new { @readonly = true })</td>
                                </tr>  
                                <tr>
                                    <td>Comment:</td><td>@Html.TextAreaFor(model => model.MembershipUser.Comment, new { @readonly = true })</td>
                                </tr>
                                <tr>
                                    <td>Active User:</td><td>@Html.CheckBoxFor(model => model.MembershipUser.IsApproved, new { disabled = true })</td>
                                </tr>                              
                            </table>                        
                    </div>                    
                    <div id="#tabrole" style="overflow:scroll; height:400px">
                    <table width="100%">
                        <tr>
                            <th>GROUP</th>      
                            <td style="font-weight:bolder">ALL</td>                      
                            <td style="font-weight:bolder">
                                <table>
                                    <tr> 
                                        <td  width="50" align="center">GRANT</td>
                                        <td  width="50" align="center">EMAIL</td>
                                        <td  width="50" align="center">INSERT</td>
                                        <td  width="50" align="center">LOCK</td>
                                        <td  width="50" align="center">MODIFY</td>
                                        <td  width="50" align="center">VALIDATE</td>
                                    </tr>
                                </table>
                             </td>
                        </tr>
                        @for (var index = 0; index < Model.userRoleGroupWrap.Count; index++)
                        {                            
                        <tr>
                            <td style="font-weight:bolder">
                                @Model.userRoleGroupWrap[index].roleDes
                            
                                @Html.HiddenFor(m => m.userRoleGroupWrap[index].roleDes)
                                
                            </td>
                            <td>    <input id="chkall_@index" type="checkbox" onclick="CheckAll('@index')"  disabled=disabled></td>
                            <td>                                        
                                <table>                                
                                    <tr>
                                    @for (var index2 = 0; index2 < Model.userRoleGroupWrap[index].userRolesWrap.Count; index2++)
                                    { 
                                        <td width="50" align="center">
                                            @Html.CheckBoxFor(m => m.userRoleGroupWrap[index].userRolesWrap[index2].check, new { disabled = "disabled" })                                          
                                            @Html.HiddenFor(m => m.userRoleGroupWrap[index].userRolesWrap[index2].roleID) 
                                            @Html.HiddenFor(m => m.userRoleGroupWrap[index].userRolesWrap[index2].userID)
                                        </td>
                                    }                                               
                                    </tr>                                
                                </table>                                                              
                            </td>
                        </tr>
                        }
                    </table>
                    </div>
         </div>      
            </div>            
        </fieldset>
            <script type="text/javascript">
                YUI().use('tabview', function (Y) {
                    var tabview = new Y.TabView({ srcNode: '#demo' });
                    tabview.render();
                });
</script>


    } 

    <div>
        @Html.ActionLink("Back to List", "Index") 
    </div>
    <script type="text/javascript">
        (function () {
            var tabView = new YAHOO.widget.TabView('demo');
        })();

    </script> 
    <script type="text/javascript">
        function chkChangeValue(value) {
            var chk = document.getElementById("userRolesWrap_" + value + "__check");
            var tr = document.getElementById("tr_" + value);
            if (chk.checked == true) {
                //alert("tr_" + value);
                tr.style.backgroundColor = "Lime";
            }
            else {
                tr.style.backgroundColor = "#edf5ff";
            }
        }
        function getvalue(name) {
            var selected = document.getElementById("selected");
            if (name == "user") {
                var user = document.getElementById(name);
                selected.value = user.innerHTML;
            }
            if (name == "membership") {
                var membership = document.getElementById(name);
                selected.value = memberbship.innerHTML;
            }
            if (name == "role") {
                var role = document.getElementById(name);
                selected.value = role.innerHTML;
            }
        }

    </script>


